/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package etp.coofy.Commands;

import etp.USB.USBService;

/**
 *
 * @author mikulski
 */
public class USB_MakeCoffee extends etp.USB.USBCommand implements etp.USB.OutputCommand {

    private USBService service;
    public static byte COMMAND = 0x55;
    
    public USB_MakeCoffee(USBService service) {
        this.service = service;
    }
    
    @Override
    public void sendCommand(USBService usbs) {
        byte[] out = this.getSendBuffer();
        out[0] = USB_MakeCoffee.COMMAND;
        out[1] = 0x0F;
        this.sendCommand(usbs, out);
    }
    
    public void sendCommand() {
        this.sendCommand(this.service);
    }

    @Override
    public void sendCommand(USBService usbs, byte[] bytes) {
       if(service.sendCommand(bytes) == false) {
           usbs.showError("Fehler beim senden des mache Kaffee Komandos");
       }     
    }
    
    public void sendCommand(USBService usbs, boolean wait) {
        byte[] out = this.getSendBuffer();
        out[0] = USB_MakeCoffee.COMMAND;
        
        if(wait) {
            out[1] = 0x0F;
        } else {
            out[1] = 0x00;
        }
        this.sendCommand(usbs, out);
    }
    
    public void sendCommand(boolean wait) {
        this.sendCommand(this.service, wait);
    }
   
}
